package com.community.controller;

import com.community.dao.ElderDao;
import com.community.dao.impl.ElderDaoImpl;
import com.community.model.Elder;

import com.community.service.ElderService;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.List;

@WebServlet("/ElderOverview")
public class ElderOverviewController extends HttpServlet {

    private ElderService elderService =new ElderService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        List<Elder> elders = elderService.getAllElders();
        request.setAttribute("elders", elders);
        request.getRequestDispatcher("/elder_manage.jsp").forward(request, response); // 转发到 JSP 页面
    }


    }
